package com.baizhi.controller;

import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@CrossOrigin //解决跨域问题
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("/loginEms")
    @ResponseBody
    public int login(@RequestBody User user){
        System.out.println(user.getUsername());
        int login = userService.login(user.getUsername(), user.getPassword());
        System.out.println(login);
        return login;
    }
}
